
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_i2c.h"
#include "i2c.h"
#include "misc.h"
#include "FlightDataStruct.h"
#include "pwm.h"
#include "usart.h"




int main(void)
{

	//set up our flight data.
	struct FlightDataStruct* state;
	struct FlightDataStruct flight;
	state = &flight;





	init_usart();
	init_I2C();
	SystemInit();
	init_Spi();
    initLeds();
    initTimer();
	init_PWM();

	InitFlightVariables(state);
	while(1){

		//UpdateI2CDAQ(state);//new using interupts
		UpdateSpiDAQ(state);

		UpdateFlightVariables(state);
		Transmit_Telemetry(state);
		UpdatePWMOutput(state);
	}
}
